<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <template v-if="isShoping">
            <div>
                <table>
                    <tr>
                        <th>Id</th>
                        <th>产品名称</th>
                        <th>商品价格</th>
                        <th>库存数量</th>
                        <th>操作</th>
                    </tr>

                    <tr v-for="(item,index) in prducts">
                        <td>{{index+1}}</td>
                        <td>{{item.prductName}}</td>
                        <td>{{item.price}}</td>
                        <td>{{item.stock}}</td>
                        <td>
                            <input type="button" value="加入购物车" @click="addShopProduct(item.id)">&nbsp;
                            <input type="button" value="不感兴趣" @click="del(item.id)">

                        </td>
                    </tr>
                </table>

                <h4>已购买{{shopTotal}}件商品&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="button" value="点击进入购物车结算" @click="settleAccounts">
                </h4>
            </div>
        </template>

        <template v-else>
            <div>
                <table>
                    <tr>
                        <th></th>
                        <th>商品名称</th>
                        <th>单价</th>
                        <th>购买数量</th>
                        <th>操作</th>
                    </tr>
                    <tr v-for="item in shopPrducts">
                        <td>{{item.id}}</td>
                        <td>{{item.prductName}}</td>
                        <td>{{item.price}}</td>
                        <td>
                            <input type="button" @click="reduceQuantity(item.id)" value="-">
                            {{item.quantity}}
                            <input type="button" @click="addQuantity(item.id)" value="+">
                        </td>

                        <td>
                            <input type="button" value="移除" @click="remove(item.id)">
                        </td>
                    </tr>

                </table>

                <h4>总价 ￥：{{totalPrice}} <input type="button" value="点击结算" @click="payment"></h4>  
            </div>
        </template>




    </div>

    <script src="./js/vue.js"></script>
    <script src="./js/idnex.js"></script>
</body>

</html>